cmake_minimum_required(VERSION 3.10)
project(PCIdentify)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 添加库源文件
set(LIB_SOURCES
    PCIdentifyLib/PCIdentify.cpp
    PCIdentifyLib/MD5.cpp
)

# 创建静态库
add_library(PCIdentifyLib STATIC ${LIB_SOURCES})

# 设置库的包含目录
target_include_directories(PCIdentifyLib PUBLIC 
    ${CMAKE_CURRENT_SOURCE_DIR}/PCIdentifyLib
)

# 添加测试可执行文件
add_executable(PCIdentifyTest PCIdentifyTest/PCIdentifyTest.cpp)

# 设置测试程序的包含目录
target_include_directories(PCIdentifyTest PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/PCIdentifyLib
)


# 链接测试程序与库
target_link_libraries(PCIdentifyTest PRIVATE PCIdentifyLib)

# 根据操作系统添加特定链接库
if(WIN32)
    target_link_libraries(PCIdentifyLib PRIVATE ws2_32)
endif()

# 设置输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
